#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/socket.h>
#include "serverTask.h"

/* 服务器处理客户端的get请求，客户端想要下载服务器的文件资源 */
int serverGetHandler(int socket_fd, FTHeader *header) {
	printf("server Get Handler!\n");
	return 0;
}

/* 服务器处理客户端的List请求，客户端想查看服务器某个目录下的文件信息 */
int serverListHandler(int socket_fd, FTHeader *header) {
	printf("server List Handler!\n");
	return 0;
}

/* 服务器处理客户端的put请求，客户端向服务器上传数据 */
int serverPutHandler(int socket_fd, FTHeader *header) {
	printf("server List Handler!\n");
	return 0;
}

int check_request(FTHeader *header, const char *method) {
	if (strncasecmp(header->data, method, strlen(method)) == 0) {
		return 1;
	}
	return 0;
}

ServerWorker workers[] ={
	{
		.method = "GET:",
		.worker_handler = serverGetHandler,
	},{
		.method = "LIST:",
		.worker_handler = serverListHandler,
	},{
		.method = "PUT:",
		.worker_handler = serverPutHandler,
	}, {
		.method = NULL,
		.worker_handler = NULL,
	}
};
